# Maintainer: Fabian Bornschein <fabiscafe-at-mailbox-dot-org>
# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

pkgbase=libdex
pkgname=(
  libdex
  libdex-docs
)
pkgver=0.4.1
pkgrel=1
pkgdesc="A library supporting 'Deferred Execution'"
url="https://gitlab.gnome.org/GNOME/libdex"
arch=(loong64 x86_64)
license=(LGPL)
depends=(
  glib2
  liburing
)
makedepends=(
  gi-docgen
  git
  gobject-introspection
  libsoup3
  libsysprof-capture
  meson
  vala
)
_commit=51f86a440d5b30b428a768f0997587cdf5462cf3  # tags/0.4.1^0
source=("git+$url.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd libdex
  git describe --tags | sed -r 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd libdex
}

build() {
  local meson_options=(
    -D docs=true
    -D sysprof=true
  )

  arch-meson libdex build "${meson_options[@]}"
  meson compile -C build
}

check() (
  meson test -C build --print-errorlogs
)

package_libdex() {
  provides=(libdex-1.so)

  meson install -C build --destdir "$pkgdir"

  mkdir -p doc/usr/share
  mv {"$pkgdir",doc}/usr/share/doc
}

package_libdex-docs() {
  pkgdesc+=" (documentation)"
  depends=()

  mv doc/* "$pkgdir"
}

# vim:set sw=2 sts=-1 et:
